package com.xht.main;

import java.util.HashMap;
import java.util.Map;

/**
 * @author xianghaitao
 * 通过实例方法工厂方法创建bean  先创建工厂本身      再调用工厂的方法创建bean
 */
public class InstanceCarFactory {
	private  Map<String, Car> cars;
	public InstanceCarFactory(){
		cars = new HashMap<String ,Car>();
		cars.put("audi", new Car("audi", "shanghai", 400000));
		cars.put("fute", new Car("fute", "shanghai", 300000));
	}
	public Car getCar(String carName){
		return cars.get(carName);
	}
}
